#颜色空间转换  BRG颜色空间模型，HSI颜色空间模型，色度红=0，饱和度，亮度
import cv2
filename = r'F:\lenna.png'
sourceimg = cv2.imread(filename)
grayimg = cv2.cvtColor(sourceimg, cv2.COLOR_BGR2GRAY)
cv2.imshow("sourceimg",sourceimg)
cv2.imshow("grayimg", grayimg)
cv2.waitKey()

hsvimg = cv2.cvtColor(sourceimg, cv2.COLOR_BGR2HSV)
cv2.imshow("hsv", hsvimg)
cv2.imshow("hue", hsvimg[:, :, 0])
cv2.imshow("saturation", hsvimg[:, :, 1])
cv2.imshow("value", hsvimg[:, :, 2])
cv2.waitKey()

cv2.imshow("bule",sourceimg[:, :, 0])
cv2.imshow("green",sourceimg[:, :, 1])
cv2.imshow("red",sourceimg[:, :, 2])
cv2.waitKey()
cv2.destroyAllWindows()